<?php
include(APP_PATH.'/Lib/Action/AuthAction.class.php');

class IndexAction extends AuthAction {
    public function index(){
		$this->assign(array(
			'account' => $_SESSION['account'],
			'isLogin' => true
		));
		$this->display();
    }
	
	public function member() {
	    
        $tblMember = M('member');
        $ret = $tblMember->select();
        
        $this->assign('list', $ret);
        
	    $this->assign(array(
            'account' => $_SESSION['account'],
            'isLogin' => true
        ));
        $this->display();
	}
    
    public function account() {
        $tbl = new Model();
        $ret = $tbl->query('
            SELECT a.uid id, a.password passwd, m.name name, m.university uni, m.email mail, a.regtime rt
            FROM sfem_member m, sfem_account a
            WHERE a.uid = m.uid
        ');
        
        $this->assign('list', $ret);
        
        $this->assign(array(
            'account' => $_SESSION['account'],
            'isLogin' => true
        ));
        $this->display();
    }

    public function paper() {
        $tbl = new Model();
        $ret = $tbl->query('
            SELECT m.uid id, m.name name, m.university uni, m.email mail, p.filename fn, p.savename sn, p.createtime ct
            FROM sfem_member m, sfem_paper p
            WHERE p.uid = m.uid
        ');
        
        $this->assign('list', $ret);
        
        $this->assign(array(
            'account' => $_SESSION['account'],
            'isLogin' => true
        ));
        $this->display();
    }
    
}